#include "widget.h"
#include "ui_widget.h"

#include <QDebug>
#include <QTextCursor>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 1.获取多行输入框中的内容

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_textEdit_textChanged()
{
    QString str = ui->textEdit->toPlainText();

    ui->label->setText(str);
}


void Widget::on_textEdit_2_textChanged()
{
    qDebug() << "[textChanged]" << ui->textEdit_2->toPlainText();
}

void Widget::on_textEdit_2_cursorPositionChanged()
{
    const QTextCursor& cursor = ui->textEdit_2->textCursor();
    qDebug() << "[cursorPositionChanged]" << cursor.position();
}

void Widget::on_textEdit_2_selectionChanged()
{
    const QTextCursor& cursor = ui->textEdit_2->textCursor();
    qDebug() << "[selectionChanged]" << cursor.selectedText();
}

void Widget::on_textEdit_2_undoAvailable(bool b)
{
    qDebug() << "[undoAvailable]" << b;
}

void Widget::on_textEdit_2_redoAvailable(bool b)
{
    qDebug() << "[redoAvailable]" << b;
}


void Widget::on_textEdit_2_copyAvailable(bool b)
{
    qDebug() << "[copyAvailable]" << b;
}
